import { memo } from "react";
import Pagination from "./Pagination";
import ArticleItem from "./ArticleItem";

const ArticlesList = memo((props)=>{
    if(!props.articles){
        return(
            <div className="article-preview">
                加载中......
            </div>
        )
    }

    if(!props.articles.length===0){
        return(
            <div className="article-preview">
                没有文章信息！！！
            </div>
            
        )
    }

    return(
        <div>
            {
                props.articles.map(article=>{
                    return(
                        <ArticleItem  article={article} key={article.slug}/>
                    )
                })
            }

            <Pagination count={props.articlesCount} current={props.currentPage} />
        </div>
    )
})


export default ArticlesList



